package com.haoshuang.zhouzhoubang.utils
import android.content.Context
import android.widget.TextView


/**
 * Copyright (c) 山东六牛网络科技有限公司 https://liuniukeji.com
 *
 * @Description
 * @Author (岱熹 )
 * @Copyright Copyright (c) 山东六牛网络科技有限公司 保留所有版权(https://www.liuniukeji.com)
 * @Date 2019/3/29
 * @CreateBy android_studio
 * @remarks
 */
object DrawableUtils{
    /**
     * position 0 左;1 上;2 右;3 下;4 不设置
     */
    fun setTextImage(context: Context,image:Int,textView: TextView,position:Int){
        var drawable = context.getResources().getDrawable(image);
        drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight())
        when(position){
            0-> textView.setCompoundDrawables(drawable, null, null, null)
            1-> textView.setCompoundDrawables(null, drawable, null, null)
            2-> textView.setCompoundDrawables(null, null, drawable, null)
            3-> textView.setCompoundDrawables(null, null, null, drawable)
            4-> textView.setCompoundDrawables(null, null, null, null)
        }
    }
}
